package com.bookcloud.java21.chapter3.循环结构_for循环_数循环34;

/** 3.4循环结构 — for循环_计数循环 */
public class Lesson34 {
  public static void main(String[] args) {
    /*
     * 计数循环，演示for循环
     * for循环的语法：
     * for(初始化表达式; 循环条件; 循环变量的变化) {
     *   循环体;
     * }
     */
    int sum = 0;
    for (int i = 1; i <= 10; i++) {
      sum = sum + i;
      System.out.println("i=" + i);
    }
    System.out.println("sum=" + sum);
  }
}
